package com.zx.sms.common;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: zhangzhiliang
 * @createTime: 2024/01/05 16:12
 * @description: xxx
 */
@AllArgsConstructor
@Getter
public enum CmppResultEnum {
    code_0(0,"正确"),
    code_1 (1,"消息结构错"),
    code_2 (2,"命令字错"),
    code_3 (3,"消息序号重复"),
    code_4 (4,"消息长度错"),
    code_5 (5,"资费代码错"),
    code_6 (6,"超过最大信息长"),
    code_7 (7,"业务代码错"),
    code_8 (8,"流量控制错"),
    code_9 (9,"本网关不负责服务此计费号码"),
    code_10(10,"Src_Id错误"),
    code_11(11,"Msg_src错误"),
    code_12(12,"Fee_terminal_Id错误"),
    code_13(13,"Dest_terminal_Id错误"),
    unknow(99,"未知错误"),
    ;

    private long code;

    private String desc;


    public static String decode(Long code){
        if (ObjectUtil.isNull(code)) {
            return unknow.desc;
        }
        for (CmppResultEnum enu : CmppResultEnum.values()){
            if (enu.code == code.longValue()){
                return enu.desc;
            }
        }
        return unknow.desc;
    }
}
